package com.example.dou2204.roomdb;

import static androidx.room.OnConflictStrategy.REPLACE;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.example.dou2204.entity.VideoRoom;

import java.util.List;

@Dao
public interface VideoDao {
    @Insert(onConflict = REPLACE)
    void insertVideo(VideoRoom videoRoom);//不小心连点了新增操作，不会崩溃报错
    @Query("select * from video where username=:name")
    List<VideoRoom> queryVideo(String name);//根据当前登录人获取收藏的数据
    @Delete
    void deleteVideo(VideoRoom videoRoom);
    @Query("select * from video where username = :name and id = :videoId")
    List<VideoRoom> queryVideoById(String name,int videoId);//根据id去查询，为了实现删除操作---
}
